#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableCurrencyFrameRangeDao:DaoBase<TableCurrencyFrameRange>
    {
        public override string GetFileName()
        {
            return "TableCurrencyFrameRange.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableCurrencyFrameRange>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableCurrencyFrameRange model)
        {
            if (!cacheOneIndex.ContainsKey(model.ItemBaseType.ToString()))
            {
                cacheOneIndex[model.ItemBaseType.ToString()] = new List<TableCurrencyFrameRange>();
            }
            cacheOneIndex[model.ItemBaseType.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableCurrencyFrameRange model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.typeId)) UnityEngine.Debug.LogError("数据表id重复:TableCurrencyFrameRange->id: " + model.typeId);
            #endif
            cachePrimaryInt[model.typeId] = model;
        }
        protected override TableCurrencyFrameRange ParseRowData(string[] rowData)
        {
            TableCurrencyFrameRange data = new TableCurrencyFrameRange();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.typeId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.ItemBaseType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.startIndex = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.endIndex = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.colorFrame = string.Intern(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.tipColorFrame = string.Intern(rowData[5]);
            }
            return data;
        }
    }
}
